<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body{
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        .box1,.box2{
            width: 250px;
            height: 70px;
            background-color: darkgrey;
            margin: 50px auto;
            cursor: pointer;
            text-align: center;
            line-height: 70px;
            font-weight: normal;
            color: white;
        }
    </style>
</head>
<body>
<div class = "box1"></div>
<div class = "box2"></div>
<script>
    let box1 = document.querySelector(".box1")
    let box2 = document.querySelector(".box2")

    box1.onmouseover = function foo1(){
        box2.innerHTML = "移入了box1"
    }
    box2.onmouseover = function foo1(){
        box1.innerHTML = "移入了box2"
    }
    box1.onmouseout = box2.onmouseout = function foo3(){
        box1.innerHTML = ""
        box2.innerHTML = ""
    }

</script>
</body>
</html>